package org.recursed.simpleweather.forecast;

import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;

public class NWSWeatherObject {
	
	private Date createdOn;
	private String moreInfoLink;
	private LinkedHashMap<String, List<TimeLayoutBand>> timeLayouts;
	private String mostRecentTimeLayout;

	private String conditionIconTimeLayout;
	private List<String> conditionIconLinks;
	
	public NWSWeatherObject() {
		timeLayouts = new LinkedHashMap<String, List<TimeLayoutBand>> ();
		conditionIconLinks = new ArrayList<String>();
	}

	public Date getCreatedOn() {
		return this.createdOn;
	}

	public String getMoreInfoLink() {
		return this.moreInfoLink;
	}

	public void setCreatedOn(Date date) {
		this.createdOn = date;
	}

	public void setMoreInfoLink(String moreInfoLink) {
		this.moreInfoLink = moreInfoLink;
	}

	public void addTimeLayout(String name) {
		mostRecentTimeLayout = name;
		timeLayouts.put(name, new ArrayList<TimeLayoutBand>());
	}
	
	public void addNewTimeBand(Date date) {
		List<TimeLayoutBand> l = timeLayouts.get(mostRecentTimeLayout);
		TimeLayoutBand tlb = new TimeLayoutBand(date);
		l.add(tlb);
	}

	public void closeCurrentTimeBand(Date end) {
		List<TimeLayoutBand> l = timeLayouts.get(mostRecentTimeLayout);
		TimeLayoutBand last = l.get(l.size()-1);
		last.setEndDate(end);
	}

	public String getConditionIconTimeLayout() {
		return this.conditionIconTimeLayout;
	}
	
	public void setConditionIconTimeLayout(String name) {
		this.conditionIconTimeLayout = name;
	}
	
	public void addConditionIconLink(String link) {
		conditionIconLinks.add(link);
	}
	
	public List<String> getConditionIconLinks() {
		return conditionIconLinks;
	}
	
}
